Skip to content

fix(workflows): guard ctx.input arrays for 0.32 UI discovery - #59

Merged
pgebheim merged 2 commits into
feature/smithersfrom
fix/workflow-ui-input-guard
Aug 1, 2026
Merged

fix(workflows): guard ctx.input arrays for 0.32 UI discovery#59
pgebheim merged 2 commits into
feature/smithersfrom
fix/workflow-ui-input-guard

Conversation

@pgebheim

@pgebheim pgebheim commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

What

Smithers 0.32's gateway renders each workflow's <UI> at startup to discover its views, calling the component with an empty ctx.input — schema defaults are not applied during discovery. Both rig-sync and rig-loop call an array method on an input field at module top level:

  • rig-sync.tsxctx.input.units.filter(...)
  • rig-loop.tsxctx.input.built.join(...)

So discovery throws TypeError: undefined is not an object, the UI fails to register, and the run's custom UI never renders in the monitor / /workflows.

Fix

Guard both with ?? []. Since each field's schema already declares .default([]), this restores exactly the intended default during discovery and is a no-op at run time.

- const work = ctx.input.units.filter((u) => u.klass === "work");
+ const work = (ctx.input.units ?? []).filter((u) => u.klass === "work");

- const seed = ctx.input.built.join(", ") || "(none)";
+ const seed = (ctx.input.built ?? []).join(", ") || "(none)";

Verification

Reproduced on a live 0.32.0 gateway (smithers gateway): the startup log showed two workflow UI discovery render failed warnings (workflow=rig-sync, workflow=rig-loop) with the ctx.input.units.filter / ctx.input.built.join stack traces. After the guard, restarting the gateway shows zero such warnings and both UIs register cleanly. Other ctx.input.* uses in these files are string interpolations (safe as undefined) or lazy lambdas (not evaluated at discovery), so these two lines are the only discovery-time crash sites.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TMUG7KT32tVitdDTjjyrgE

pgebheim and others added 2 commits August 1, 2026 20:26
Smithers 0.32's gateway renders each workflow's <UI> at startup to
discover its views, calling the component with an empty `ctx.input`
(schema defaults are NOT applied during discovery). rig-sync and
rig-loop both call an array method on an input field at module top —
`ctx.input.units.filter(...)` and `ctx.input.built.join(...)` — so
discovery throws `TypeError: undefined is not an object`, the UI fails
to register, and the run's custom UI never renders in the monitor.

Guard both with `?? []`, which restores exactly the schema's own
`.default([])` during discovery and is a no-op at run time. Verified
against a 0.32 gateway: the two "workflow UI discovery render failed"
warnings are gone and both UIs register.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TMUG7KT32tVitdDTjjyrgE
`<Unit key={u.id} …>` is rendered in `work.map(...)`, but Unit is a plain
function component whose props type didn't declare `key`. Under the smithers
JSX types, `key` isn't auto-injected for function components (built-ins like
<Task>/<Sequence> carry it), so it was rejected as an excess prop — TS2322 at
the call site. Declaring `key?: string` on Unit's props keeps the list-identity
key and makes `typecheck smithers/` pass. Pre-existing failure on
feature/smithers, surfaced independently of the UI-discovery guard.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TMUG7KT32tVitdDTjjyrgE
@pgebheim
pgebheim marked this pull request as ready for review August 1, 2026 20:36
@pgebheim
pgebheim merged commit fb9bda8 into feature/smithers Aug 1, 2026
2 checks passed
@pgebheim
pgebheim deleted the fix/workflow-ui-input-guard branch August 1, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant